import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Admin
 * Date: 2022-12-06
 * Time: 21:14
 */
public class Demo2 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);

        while(scan.hasNext()) {
            StringBuffer s1 = new StringBuffer(scan.next());
            StringBuffer s2 = new StringBuffer(scan.next());
            int len1 = scan.nextInt();
            int len2 = scan.nextInt();


            for(int i = s1.length(); i < len2; i++) {
                s1.append('a');
            }

            for(int j = s2.length(); j < len2; j++) {
                s2.append('z'+1);
            }

            int[] array = new int[len2];

            for(int i = 0; i < len2; i++) {
                array[i] = s2.charAt(i) - s1.charAt(i);
            }

            int sum = 0;
            for(int i = len1; i <= len2; i++) {
                for(int j = 0; j < i; j++) {
                    sum += array[j] * Math.pow(26,i-j-1);
                }
            }

            System.out.println((sum-1)%1000007);
        }
    }
}
